home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / conqsrc.lha / Conquest / src / misc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-03  |  4.1 KB  |  157 lines

  1. /* Misc.c: Miscellaneous routines I didn't know where else to put. */
  2. #include <stdio.h>
  3. #include "defs.h"
  4. #include "structs.h"
  5. #include "vars.h"
  6. #include "protos.h"
  7.  
  8. struct helpst 
  9. {
  10.   char *cmd, *does;
  11. };
  12.  
  13. struct helpst help0[] =
  14. {
  15. {       "B",    "Bld Battlestar(s)    75"},
  16. {       "C",    "Bld Cruiser(s)       16"},
  17. {       "H",    "Help"                   },
  18. {       "R",    "Range Research"         },
  19. {       "S",    "Bld Scout(s)          6"},
  20. {       "V",    "Velocity Research"      },
  21. {       "W",    "Weapons Research"       },
  22. {       ">M",   "Redraw Map"             },
  23. {       ">R",   "Research summary"       },
  24. {       0,      0                        }
  25. };
  26.  
  27. struct helpst help1[] =
  28. {
  29. {       "B",    "Blast Planet"           },
  30. {       "C",    "Colony summary"         },
  31. {       "D",    "TaskForce Destination"  },
  32. {       "G",    "Go on (done)"           },
  33. {       "H",    "Help"                   },
  34. {       "J",    "Join TaskForces"        },
  35. {       "L",    "Land transports"        },
  36. {       "M",    "Redraw Map"             },
  37. {       "N",    "New TaskForce"          },
  38. {       "Q",    "Quit"                   },
  39. {       "R",    "Research summary"       },
  40. {       "S",    "Star summary"           },
  41. {       "T",    "TaskForce summary"      },
  42. {       0,      0                        }
  43. };
  44.  
  45. struct helpst help2[] =
  46. {
  47. {       "C",    "Colonies"               },
  48. {       "G",    "Go on (done)"           },
  49. {       "H",    "Help"                   },
  50. {       "M",    "Map"                    },
  51. {       "O",    "Odds"                   },
  52. {       "R",    "Research summary"       },
  53. {       "S",    "Star summary"           },
  54. {       "T",    "TaskForce summary"      },
  55. {       "W",    "Withdraw"               },
  56. {       0,      0,                       }
  57. };
  58.  
  59. struct helpst help3[] = 
  60. {
  61. {       "B",    "Break off Attack"       },
  62. {       "C",    "Colony summary"         },
  63. {       "G",    "Go on (done)"           },
  64. {       "H",    "Help"                   },
  65. {       "J",    "Join TFs"               },
  66. {       "M",    "Redraw Map"             },
  67. {       "N",    "New TF"                 },
  68. {       "R",    "Research summary"       },
  69. {       "S",    "Star summary"           },
  70. {       "T",    "TaskForce summary"      },
  71. {       0,      0                        }
  72. };
  73.  
  74. struct helpst help4[] = 
  75. {
  76. {       "A",    "Bld Adv. Missle Base 35"},
  77. {       "B",    "Bld Battlestar(s)    70"},
  78. {       "C",    "Bld Cruiser(s)       16"},
  79. {       "H",    "Help"                   },
  80. {       "I",    "Invest                3"},
  81. {       "M",    "Bld Missle Base(s)    8"},
  82. {       "R",    "Range Research"         },
  83. {       "S",    "Bld Scout(s)          6"},
  84. {       "T",    "Bld Transports"         },
  85. {       "V",    "Vel Research"           },
  86. {       "W",    "Weapons Research"       },
  87. {       "*x",   "Bld max. # of x"        },
  88. {       "+",    "Bld max. offensive"     },
  89. {       "-",    "Bld max. defensive"     },
  90. {       ">C",   "Colony summary"         },
  91. {       ">M",   "Redraw Map"             },
  92. {       ">R",   "Research summary"       },
  93. {       ">S",   "Star summary"           },
  94. {       0,      0                        }
  95. };
  96.  
  97. void help(int which)
  98. {
  99.   struct helpst *h;
  100.   int j;
  101.   
  102.   j = 1;
  103.   point(50, j++);
  104.   if (which == 0) h = help0;
  105.   if (which == 1) h = help1;
  106.   if (which == 2) h = help2;
  107.   if (which == 3) h = help3;
  108.   if (which == 4) h = help4;
  109.   while (h->cmd != 0) 
  110.   {
  111.     printf("%2s - %-25s", h->cmd, h->does);
  112.     point(50, j++);
  113.     h++;
  114.   }
  115.   clear_field();
  116. }
  117.  
  118. void on_board(int x, int y)
  119. {
  120.   int i;
  121.   int starnum;
  122.   board[x][y].tf=' ';
  123.   i=1;
  124.   do 
  125.   {
  126.     if ( (tf[player][i].dest!=0) && (tf[player][i].x==x) 
  127.     && (tf[player][i].y==y
  128.         ) ) 
  129.     {
  130.       if ( board[x][y].tf==' ' )
  131.     board[x][y].tf= i+'a'-1;
  132.       else 
  133.       {
  134.     board[x][y].tf='*';
  135.     i=27;
  136.       }
  137.     }
  138.     i=i+1;
  139.   } 
  140.   while (i <= 26);
  141.   if ( board[x][y].star != '.' ) 
  142.   {
  143.     board[x][y].enemy = ' ';
  144.     starnum= board[x][y].star - 'A' +1;
  145.     if ( col_stars[starnum][player] != 0 )
  146.       board[x][y].enemy = '@';
  147.   }
  148.   update_board(x,y,both);
  149. }
  150.  
  151. void pause()
  152. {
  153.   point(1,18);
  154.   printf("Press any key to continue  ");
  155.   get_char();
  156. }
  157.